/**
 * <p>Title: ServiceZMCEF1.java</p>
 * <p>Description: </p>
 * <p>Copyright: Baosight Software LTD.co Copyright (c) 2002</p>
 * <p>Company: Baosight Software</p>
 * @author 张志芳
 * @version 1.0
 * <pre>Histroy:
 *          2012-1-17 上午09:59:41  张志芳  Create
 *</pre>
 */
package com.baosight.sczx.zm.ce.service;

import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.ep.ServiceEPBase;
import com.baosight.sczx.common.zm.basetools.StaticTools;
import com.baosight.sczx.common.zm.cInterface.Department;
import com.baosight.sczx.common.zm.cInterface.ce.EquipmentClass;
import com.baosight.sczx.common.zm.cInterface.cs.Engineering;
import com.baosight.sczx.common.zm.cInterface.cs.InitialData;
import com.baosight.sczx.zm.ce.domain.ZMCEEquipmentCard;

/**
 * 设备台账
 * <p>Title: ServiceZMCEF1.java</p>
 * <p>Description: </p>
 * <p>Copyright: Baosight Software LTD.co Copyright (c) 2002</p>
 * <p>Company: Baosight Software</p>
 * @author 张志芳
 * @version 1.0
 * <pre>Histroy:
 *          2012-1-17 上午09:59:41  张志芳  Create
 *</pre>
 */
public class ServiceZMCEF1 extends ServiceEPBase {
	
	/**
	 * 初始化方法
	 * <p>Function: initLoad</p>
	 * <p>Description: </p>
	 * <p>return value: ServiceZMCEEquipmentCard</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-4-8上午09:57:14 张志芳
	 * </p>
	 *
	 */
	public EiInfo initLoad(EiInfo inInfo) {
		inInfo.addBlock(EiConstant.resultBlock).set("showCount", "true");//如果不加这个，翻页的统计和显示是错误的
		EiInfo outInfo = this.query(inInfo);
		outInfo.addBlock(EquipmentClass.getEquipmentClassBlock("cmes.ce.equipmentClass", null));//设备分类
		outInfo.addBlock(Engineering.getEngineering("cmes.cp.engineering", null, false));//工程
		outInfo.addBlock(Department.getInstance().getConstructionUnit("cmes.ce.department", "orgCode", "orgName", false));//部门
		outInfo.addBlock(InitialData.getInstance().getEiBlockByNo("cmes.ce.equipmentSource", true));//设备来源
		return outInfo;
	}

	/**
	 * 设备查询
	 * <p>Function: query</p>
	 * <p>Description: </p>
	 * <p>return value: ServiceZMCEEquipmentCard</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-1-26下午04:23:36 张志芳
	 * </p>
	 *
	 */
	@Override
	public EiInfo query(EiInfo inInfo) {
		String fdToencode = inInfo.getString("fdToencode");
		StaticTools.setQueryParameters(inInfo, "fdToencode", fdToencode, true);//添加查询条件
		EiInfo outInfo = super.query(inInfo, "ZMCEEquipmentCard.query", new ZMCEEquipmentCard());

		return outInfo;
	}
}
